package com.hfb.mashibing.alip8.spring.shardingsphere.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;


/**
 * 动态数据源的切换
 */
public class DataSourceRouter extends AbstractRoutingDataSource {

    @Override
    protected Object determineCurrentLookupKey() {
        // 返回选择的数据源
       return DataSourceContextHolder.getDataSourceType();
    }
}
